from django.db import models

# Create your models here.

from django.contrib.auth.models import User

class Greeting(models.Model):
    author = models.ForeignKey(User, null=True, blank=True)
    content = models.TextField()
    date = models.DateTimeField(auto_now_add=True)
    
class Location(models.Model):
    Name = models.CharField(max_length = 50)
    x = models.IntegerField()
    y = models.IntegerField()

class CatInfo(models.Model):
    Name = models.CharField(max_length=50)
    Sex = models.IntegerField() #0 for female 1 for male 2 for unkonwn
    Portrait = models.TextField(max_length=1024) #image url
    CurLocation = models.ForeignKey(Location)

class CatStatus(models.Model):
    CatID = models.ForeignKey(CatInfo) #Cat ID
    Type = models.IntegerField() #0 for location
    #1 for treat   2 for photo update    3 for say something
    TargetID = models.IntegerField()


"""
    Oath User Model
"""
class OpenUser(models.Model):
    # the hidden 'id' is RenRenID
    Name = models.CharField(max_length=50)
    Access_Token = models.CharField(max_length = 200)
    
    
    

class CatImpression(models.Model):
    CatID = models.ForeignKey(CatInfo)
    UserID = models.ForeignKey(OpenUser)
    Content = models.CharField(max_length=50)
    Time = models.DateTimeField()
    
class Post(models.Model):
    Time = models.DateTimeField()
    Author = models.ForeignKey(OpenUser)
    Content = models.TextField()
    BelongID = models.IntegerField()#Belong ID
    
class Album(models.Model):
    URL = models.TextField(max_length = 1024)
    CatID = models.ForeignKey(CatInfo)
    Time = models.DateTimeField()
    Author = models.ForeignKey(OpenUser)
    
class Treat(models.Model):
    Time = models.DateTimeField()
    Author = models.ForeignKey(OpenUser)#open user ID
    CatID = models.ForeignKey(CatInfo)
    
class Saying(models.Model):
    Time = models.DateTimeField()
    CatID = models.ForeignKey(CatInfo)
    Content = models.TextField()

class LocationInfo(models.Model):
    LocationID = models.ForeignKey(Location)
    Time = models.DateTimeField()
    CatID = models.ForeignKey(CatInfo)
    
# for special concerns
class Favorite(models.Model):
    CatID = models.ForeignKey(CatInfo)
    UserID = models.ForeignKey(OpenUser)
    